package com.itheima.tlias84.aop.cglib;

import org.springframework.cglib.proxy.Enhancer;

public class TestCglib {
    public static void main(String[] args) {
        //1.创建增强对象
        Enhancer enhancer = new Enhancer();
        //2.给增强对象设置要代理的父类以及拦截器回调
        enhancer.setSuperclass(Dog.class);
        //回调
        enhancer.setCallback(new EatInterceptor());
        //3.创建方法拦截器类,实现MethodInterceptor接口
        //EatInterceptor implements MethodInterceptor
        //4.创建代理对象
        Dog dog = (Dog) enhancer.create();
        dog.eat();




    }
}
